package org.bjf.modules.process.service;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.bjf.modules.core.service.BaseService;
import org.bjf.modules.process.bean.ProcessAudit;
import org.bjf.modules.process.mapper.ProcessAuditMapper;
import org.bjf.modules.process.query.ProcessAuditQuery;
import org.springframework.stereotype.Service;


@Service
@Slf4j
public class ProcessAuditService extends BaseService<ProcessAuditMapper, ProcessAudit, ProcessAuditQuery> {

  @Override
  protected LambdaQueryWrapper<ProcessAudit> buildQuery(ProcessAuditQuery q) {
    if (q == null) {
      return null;
    }
    LambdaQueryWrapper<ProcessAudit> qw = new LambdaQueryWrapper<>();
    qw.eq(q.getAuditUserId() != null, ProcessAudit::getAuditUserId, q.getAuditUserId());
    qw.eq(StringUtils.isNotBlank(q.getPiId()), ProcessAudit::getPiId, q.getPiId());
    return qw;
  }
}
